import {
  createRouter as _createRouter,
  createMemoryHistory,
  createWebHashHistory,
  RouteRecordRaw,
} from "vue-router";
const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "home",
    component: () => import("@/views/Home/index.vue"),
  },
  {
    path: "/brandStory",
    name: "brandStory",
    component: () => import("@/views/BrandStory/index.vue"),
  },
  {
    path: "/product",
    name: "product",
    component: () => import("@/views/Product/index.vue"),
  },
  {
    path: "/productDetail",
    name: "productDetail",
    component: () => import("@/views/Product/detail.vue"),
  },
  {
    path: "/blog",
    name: "blog",
    component: () => import("@/views/Blog/index.vue"),
  },
  {
    path: "/blogDetail",
    name: "blogDetail",
    component: () => import("@/views/Blog/detail.vue"),
  },
  {
    path: "/appIntroduction",
    name: "appIntroduction",
    component: () => import("@/views/App/index.vue"),
  },
  {
    path: "/affiliate",
    name: "affiliate",
    component: () => import("@/views/Affiliate/index.vue"),
  },
];

export const createRouter = () => {
  return _createRouter({
    scrollBehavior() {
      return { top: 0 };
    },
    history: import.meta.env.SSR
      ? createMemoryHistory()
      : createWebHashHistory(),
    routes,
  });
};
